Embedded microcontrollers are capable of different power modes which are usually controlled by dedicated instructions like HALT, SLEEP, DEEP_SLEEP etc. These dedicated instructions require a special handling for switching from one power mode to another, ensuring that the controller returns to the same mode as before. One example is the MSP430 microcontroller of Texas Instruments. It uses power mode control (PMC) bits in the status register which are saved together with the program counter onto the stack during each interrupt request service sequence. These PMC bits control the operational condition directly. For example all clock activities may be stopped inside of peripheral modules depending on the state of the PCM bits.
With such architecture, however, the possible power mode scenarios are limited. Many more power mode scenarios can be generated by executing code. Advanced software solutions e.g. use dynamic voltage-frequency scaling and turn on or off specific selected circuits. A software approach, however, needs more power and performance. The real-time nature of interrupt handling is negatively impacted and may need higher execution speed. The software approach needs some protection to complete, at least, certain parts of power mode modifications so that no locking situation can happen.